<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>获取cURL版本信息</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.curl-unescape.html">curl_unescape</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="book.event.html">Event</a></div>
 <div class="up"><a href="ref.curl.html">cURL 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.curl-version" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">curl_version</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.2, PHP 5)</p><p class="refpurpose"><span class="refname">curl_version</span> &mdash; <span class="dc-title">获取cURL版本信息</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.curl-version-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">array</span> <span class="methodname"><strong>curl_version</strong></span>
    ([ <span class="methodparam"><span class="type">int</span> <code class="parameter">$age</code><span class="initializer"> = CURLVERSION_NOW</span></span>
  ] )</div>

  <p class="para rdfs-comment">
   返回关于cURL的版本信息。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.curl-version-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">age</code></em></dt>

     <dd>

      <p class="para">
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.curl-version-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   返回一个相关的数组包含如下元素：
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Indice</th>
       <th>值描述</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>version_number</td>
       <td>cURL 24位版本号</td>
      </tr>

      <tr>
       <td>version</td>
       <td>cURL 版本号，字符串形式</td>
      </tr>

      <tr>
       <td>ssl_version_number</td>
       <td>OpenSSL 24 位版本号</td>
      </tr>

      <tr>
       <td>ssl_version</td>
       <td>OpenSSL 版本号，字符串形式</td>
      </tr>

      <tr>
       <td>libz_version</td>
       <td>zlib 版本号，字符串形式</td>
      </tr>

      <tr>
       <td>host</td>
       <td>关于编译cURL主机的信息</td>
      </tr>

      <tr>
       <td>age</td>
       <td class="empty">&nbsp;</td>
      </tr>

      <tr>
       <td>features</td>
       <td>一个<em>CURL_VERSION_XXX</em>常量的位掩码</td>
      </tr>

      <tr>
       <td>protocols</td>
       <td>一个cURL支持的协议名字的数组</td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.curl-version-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-4142">
    <p><strong>Example #1 <span class="function"><strong>curl_version()</strong></span> example</strong></p>
    <div class="example-contents"><p>
     这个范例将会检查当前cURL版本使用<span class="function"><strong>curl_version()</strong></span>返回的&#039;features&#039;位掩码中哪些特性是可用的。
    </p></div>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;获取cURL版本数组<br /></span><span style="color: #0000BB">$version&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">curl_version</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">//&nbsp;在cURL编译版本中使用位域来检查某些特性<br /></span><span style="color: #0000BB">$bitfields&nbsp;</span><span style="color: #007700">=&nbsp;Array(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'CURL_VERSION_IPV6'</span><span style="color: #007700">,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'CURL_VERSION_KERBEROS4'</span><span style="color: #007700">,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'CURL_VERSION_SSL'</span><span style="color: #007700">,&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'CURL_VERSION_LIBZ'<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">);<br /><br /><br />foreach(</span><span style="color: #0000BB">$bitfields&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">$feature</span><span style="color: #007700">)<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">$feature&nbsp;</span><span style="color: #007700">.&nbsp;(</span><span style="color: #0000BB">$version</span><span style="color: #007700">[</span><span style="color: #DD0000">'features'</span><span style="color: #007700">]&nbsp;&amp;&nbsp;</span><span style="color: #0000BB">constant</span><span style="color: #007700">(</span><span style="color: #0000BB">$feature</span><span style="color: #007700">)&nbsp;?&nbsp;</span><span style="color: #DD0000">'&nbsp;matches'&nbsp;</span><span style="color: #007700">:&nbsp;</span><span style="color: #DD0000">'&nbsp;does&nbsp;not&nbsp;match'</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.curl-unescape.html">curl_unescape</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="book.event.html">Event</a></div>
 <div class="up"><a href="ref.curl.html">cURL 函数</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
